package dale.web.english.repository;

import java.util.List;

import org.apache.ibatis.session.RowBounds;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import dale.web.common.model.Condition;
import dale.web.english.model.English;

@Repository
public class EnglishRepositoryBatis implements EnglishRepository {
	
	protected SqlSessionTemplate template;

	@Autowired
	public EnglishRepositoryBatis(SqlSessionTemplate template) {
		this.template = template;
	}

	@Override
	public int count(Condition<English> condition) {
		return template.selectOne("English.count", condition);
	}

	@Override
	public List<English> selectList(Condition<English> condition, int offset, int limit) {
		RowBounds bounds = new RowBounds(offset, limit);
		return template.selectList("English.selectList", condition, bounds);
	}

	@Override
	public List<English> selectList(English item) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public English selectOne(Integer no) {
		return template.selectOne("English.selectOne", no);
	}

	@Override
	public int insert(English item) {
		return template.insert("English.insert", item);
	}

	@Override
	public int update(English item) {
		return template.update("English.update", item);
	}

	@Override
	public int delete(Integer no) {
		return template.delete("English.delete", no);
	}

}
